home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c++ / 437 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  1.9 KB

  1. Path: engnews1.Eng.Sun.COM!taumet!clamage
  2. From: phalpern@truffle.ultranet.com (Pablo Halpern)
  3. Newsgroups: comp.std.c++
  4. Subject: Re: proposal: renew & relocator member fn
  5. Date: 22 Feb 1996 15:51:17 GMT
  6. Organization: UltraNet Communications, Inc.
  7. Approved: clamage@eng.sun.com (comp.std.c++)
  8. Message-ID: <4ghtnb$u0u@caesar.ultra.net>
  9. References: <GNB.96Feb7140952@dame.bby.com.au> <4fgfpu$oth@hermes.synopsys.com>
  10. NNTP-Posting-Host: taumet.eng.sun.com
  11. Content-Type: text
  12. X-Nntp-Posting-Host: truffle.ultranet.com
  13. X-Newsreader: Forte Agent .99b.113
  14. Content-Length: 1050
  15. X-Lines: 31
  16. Originator: clamage@taumet
  17.  
  18. jbuck@Synopsys.COM (Joe Buck) wrote:
  19.  
  20. > [Discussion about need for a special relocation constructor/destructor ]
  21.  
  22. >Consider the template
  23. >
  24. >template<class T>
  25. >T* relocate(T* oldloc, void* newloc) {
  26. >    T* result = new(newloc) T(*oldloc);
  27. >    oldloc->~T();
  28. >}
  29. >
  30. > [Discussion about how this template be specialized for classes where
  31.    relocation could be made cheaper]
  32. >
  33.  
  34. I like this a lot. I wouldn't mind seeing this added to the standard
  35. library and used in the implementation of STL.
  36.  
  37. It doesn't solve one problem that realloc() does solve: the ability to
  38. prevent relocation if the allocator is able to grow a block without
  39. relocating it. I believe run-time library support tied to a language
  40. extension is needed if you are to take advantage of an operating-system
  41. capability like that. We can probably live without such a language
  42. extension.
  43. -------------------------------------------------------------
  44. Pablo Halpern                   phalpern@truffle.ultranet.com
  45.  
  46. I am self-employed. Therefore, my opinions *do* represent 
  47. those of my employer.
  48.  
  49.  
  50. [ To submit articles: Try just posting with your newsreader.
  51.               If that fails, use mailto:std-c++@ncar.ucar.edu
  52.   FAQ:    http://reality.sgi.com/employees/austern_mti/std-c++/faq.html
  53.   Policy: http://reality.sgi.com/employees/austern_mti/std-c++/policy.html
  54.   Comments? mailto:std-c++-request@ncar.ucar.edu
  55. ]
  56.